package com.simple.sso.server.utils;

public enum JsonStatus {

    SUCCESS("00", "SUCCESS"),
    ERROR("01", "ERROR");

    private String code;

    private String desc;

    JsonStatus(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return this.code;
    }

    public String getDesc() {
        return desc;
    }

    //根据code获取desc
    public static String getDescByCode(String code) {
        for (JsonStatus enums : values()) {
            if (code.equals(enums.getCode())) {
                return enums.getDesc();
            }
        }

        return null;
    }
}
